package util;

import pojo.Novel;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

public class SaveFile {
    public static void saveNovel(List<Novel> novels, String path) throws IOException {

        File file=new File(path);
        if (!file.exists()) {
            file.createNewFile();
        }

        FileWriter fileWriter=new FileWriter(file,true);
        for (Novel novel : novels) {
            fileWriter.write(novel.getContent());
        }
        fileWriter.close();
    }
}
